package com.gitee.wsl.compose.modifier.state

import androidx.compose.runtime.Stable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import com.gitee.wsl.compose.modifier.ModifierStateScope

@Stable
fun Modifier.visible(visibility: Boolean): Modifier {
    return if (visibility) {
        this.then(alpha(1f))
    } else {
        this.then(alpha(0f))
    }
}

fun ModifierStateScope.visibale(visibility: Boolean){
    modifier = modifier.visible(visibility)
}